﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Diagnostics;
using System.Data;
using System.Data.Common;

namespace DistributedCacheDataProvider
{
    class DistributedCacheDataAdapter : DbDataAdapter, IDbDataAdapter, IDataAdapter 
    {
        // three constructors.
		// no point in having one that takes connection string 
		// and command string as we don't use connection string

		public DistributedCacheDataAdapter() 
		{
			Debug.WriteLine("DistributedCacheDataAdapter.constructor", "DistributedCacheDataAdapter");
		}

		public DistributedCacheDataAdapter(DistributedCacheCommand cmd) 
		{
			Debug.WriteLine("DistributedCacheDataAdapter.constructor(cmd)", "DistributedCacheDataAdapter");
			SelectCommand = cmd;
		}

		public DistributedCacheDataAdapter(String strCommand, DistributedCacheConnection conn) 
		{
			Debug.WriteLine("DistributedCacheDataAdapter.constructor(string, conn)", "DistributedCacheDataAdapter");
			SelectCommand = new DistributedCacheCommand(strCommand, conn);
		}

		void NotSupported()
		{
			throw new System.NotSupportedException();
		}

		void NotImpl()
		{
			throw new System.NotImplementedException();
		}

        protected override RowUpdatedEventArgs CreateRowUpdatedEvent(
					  DataRow dataRow,
					  IDbCommand command,
					  StatementType statementType,
					  DataTableMapping tableMapping)
		{
			Debug.WriteLine("MDirDataReader.CreateRowUpdatedEvent", "DistributedCacheDataAdapter"); 
			NotSupported();
			return null;
		}
		
	    protected override RowUpdatingEventArgs CreateRowUpdatingEvent(
						DataRow dataRow,
						IDbCommand command,
						StatementType statementType,
						DataTableMapping tableMapping) 
		{
			Debug.WriteLine("DistributedCacheDataAdapter.CreateRowUpdatingEvent", "DistributedCacheDataAdapter");  
			NotSupported();
			return null;
		}

		protected override void OnRowUpdated(RowUpdatedEventArgs args) 
		{
			Debug.WriteLine("DistributedCacheDataAdapter.OnRowUpdated", "DistributedCacheDataAdapter"); 
		}
		protected override void OnRowUpdating(RowUpdatingEventArgs args) 
		{
			Debug.WriteLine("DistributedCacheDataAdapter.get_OnRowUpdating", "DistributedCacheDataAdapter"); 
		}

		/*
		IDbCommand _InsertCommand;
		public IDbCommand InsertCommand
		{
			get 
			{
				Debug.WriteLine("DistributedCacheDataAdapter.get_InsertCommand", "DistributedCacheDataAdapter");  
				NotSupported();
				return _InsertCommand;
			}
			set 
			{
				Debug.WriteLine("DistributedCacheDataAdapter.set_InsertCommand", "DistributedCacheDataAdapter"); 
				NotSupported(); 
				_InsertCommand = value;
			}
		}

		IDbCommand _UpdateCommand;
		public IDbCommand UpdateCommand
		{
			get 
			{
				Debug.WriteLine("DistributedCacheDataAdapter.get_UpdateCommand", "DistributedCacheDataAdapter");  
				NotSupported();
				return _UpdateCommand;
			}
			set 
			{
				Debug.WriteLine("DistributedCacheDataAdapter.set_UpdateCommand", "DistributedCacheDataAdapter");  
				NotSupported();
				_UpdateCommand = value;
			}
		}

		IDbCommand _DeleteCommand;
		public IDbCommand DeleteCommand
		{
			get 
			{
				Debug.WriteLine("DistributedCacheDataAdapter.get_DeleteCommand", "DistributedCacheDataAdapter");  
				NotSupported();
				return _DeleteCommand;
			}
			set 
			{ 
				Debug.WriteLine("DistributedCacheDataAdapter.set_DeleteCommand", "DistributedCacheDataAdapter"); 
				NotSupported();
				_DeleteCommand = value;
			}
		}

		IDbCommand _SelectCommand;
		public IDbCommand SelectCommand
		{
			get 
			{ 
				Debug.WriteLine("DistributedCacheDataAdapter.get_SelectCommand", "DistributedCacheDataAdapter"); 
				return _SelectCommand;
			}
			set 
			{ 
				Debug.WriteLine("DistributedCacheDataAdapter.set_SelectCommand", "DistributedCacheDataAdapter"); 
				_SelectCommand = value;
			}
		}
		*/
    }
}
